interactive data visualization

Row

car failure Analysis

Failure

car failure Analysis in US

1624

Labour cost

Massachusetts

21

California

200

Florida

293

Row

Failure by State

Top States

FM Vs Milage

Sctter plot of Month Vs Mileage ->

Box plot of Top State->

Map

Map

Data Table

Pivot Table

Summary report { data-orientation =columns}

Column{data-Width =100}

Max failure month

23

Average labour cost

242.92

Average Mileage at failure

20578.67

Column

Report

  • This is report on 1624car failure,
  • Average labor cost was 242.9180111.
  • Average material cost was 179.3948276.
  • This report was generate on ‘r formate(sys.date()),format="%B %d %y)’

About Report

---
title: "S.Deshboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    social: ["linkedin","Twitter","Menu"]
    source_code: embed
editor_options: 
  chunk_output_type: console
---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(DT)
library(rpivotTable)
library(ggplot2)
library(dplyr)
library(openintro)
library(highcharter)
library(plotly)
library(ggvis)
library(tidyverse)
```
```{r}
df<-read.csv("C:\\Users\\hp\\OneDrive\\Desktop\\R_dataset\\vehicle.csv")
#str(df)
#View(df)
```

```{r}
col <-c("blue","red","darkgreen","dark","darkorange")

```
interactive data visualization
================================

Row
--------------------------------

### car failure Analysis 
```{r}
valueBox(paste("Failure"),
         color = "warning")
```

### car failure Analysis in US

```{r}
valueBox(length(df$State),
         icon = "fa-user")
                
         
```

### **Labour cost **

```{r}
gauge(round(mean(df$lc),
         digits = 2),
         min =0,
         max=350,
         gaugeSectors(success = c(0,150),
         warning = c(150,240),
         danger = c(240,350),
         colors = c("green","yellow","red")))
```

### Massachusetts

```{r}
valueBox(sum(df$State=="MA"),
         icon = 'fa-building')
```

### California

```{r}
valueBox(sum(df$State=="CA"),
         icon = 'fa-building')
```

###  Florida

```{r}
valueBox(sum(df$State=="TX"),
         icon = 'fa-building')
```

Row
------------------

### Failure by State

```{r}
p1<- df %>%
  group_by(State) %>%
  summarise(count =n())%>%
  plot_ly(x = ~State,
          y = ~count,
          color = rainbow(51),
          type = 'bar')%>%
layout(xaxis = list(title = "Failure by State"),
yaxis =list(title ='Count'))
p1
```

### Top States

```{r}
p2<- df %>%
  group_by(State) %>%
  summarise(count =n())%>%
  filter(count >50)%>%
  plot_ly(labels = ~State,
          values = ~count,
          marker=list(color=rainbow(5)))%>%
          add_pie(hole=0.2)%>%
          layout(xaxis = list(zeroline= F,
                              showline=F,
                              showtricklabel=F,
                              showgrid=F))
                yaxis = list(zeroline= F,
                              showline=F,
                              showtricklabel=F,
                              showgrid=F)
p2
```

### FM Vs Milage

```{r}
p3 <-plot_ly(df,
             x = ~fm,
             y= ~Mileage,
             text=paste("FM:" ,df$fm,"Milage",
             df$Mileage),
             type = "bar")%>%
        layout(xaxis=list(title="FM"),
               yaxis=list(title="failure Milage"))
p3
```

### Sctter plot of Month Vs Mileage ->

```{r}
p4 <-plot_ly(df,x= ~fm) %>%
  add_markers(y= ~Mileage,
              text = ~paste("Mileage:", Mileage),
              showlegend =F) %>%
  add_lines(y = ~fitted(loess(Mileage ~fm)),
            name ="loess Smoother",
            color = I("#FFC125"),
            showlegend =T,
            line =list(width =5))%>%
  layout(xaxis = list(title = "month"),
         yaxis =list(title = "Mileage"))
p4
  
```

### Box plot of Top State->

```{r}
df %>%
  group_by(State) %>%
  ggvis(~State,~lc,fill= ~State) %>%
  layer_boxplots()
```

Map
====================

### Map

```{r}
car <- df %>%
  group_by(State) %>%
  summarise(total =n())
car$State <-abbr2state(car$State)

highchart() %>%
          hc_title(text = "car failure in US") %>%
          hc_subtitle(text ="source :vehicle.csv")%>%
          hc_add_series_map(usgeojson,car,
                            name="State",
                            value = "total",
                            joinBy = c("woename","State")) %>%
hc_mapNavigation(enabled =T)
```


Data Table
=============================


```{r}
datatable(df,caption = "failure Data",
          rownames = T,
          filter = "top",
          options = list(pagelength =25))
```

Pivot Table
============================

```{r}
rpivotTable(df,aggregatorName = "count",
            col= "fm",
            rows = "state",
            rendername = "Heatmap")
```

Summary report { data-orientation =columns}
==========================================

Column{data-Width =100}
------------------------------------------

### Max failure month

```{r}
valueBox(max(df$fm),
         icon = "fa user")
```

### Average labour cost
```{r}
valueBox(round(mean(df$lc),
               digits = 2),
         icon = "fa-area-chart")
```

### Average Mileage at failure

```{r}
valueBox(round(mean(df$Mileage),
               digits = 2),
         icon = "fa-area-chart")
```

Column
----------------

Report

* This is report on `r length(df$fm)`car failure,
* Average labor cost was `r mean(df$lc)`.
* Average material cost was `r mean(df$mc)`.
* This report was generate on 'r formate(sys.date()),format="%B %d %y)'

About Report
======================


* Created by : Data Scientist at ABC
* confidential : HIGHLY!